﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Northwind.NET.FE.Reports
{
    public partial class CustomersLabelsReport : Form
    {
        public CustomersLabelsReport()
        {
            InitializeComponent();
        }

        private string _countryName; 
        private void CustomersLabelsReport_Load(object sender, EventArgs e)
        {
            _countryName = null;

            // TODO: This line of code loads data into the 'dataModelDataSet.CustomerCountries' table. You can move, or remove it, as needed.
            this.customerCountriesTableAdapter.Fill(this.dataModelDataSet.CustomerCountries);

            countryComboBox.Text = null;

            refreshReport();
            this.WindowState = FormWindowState.Maximized;         
        }

        private void refreshButton_Click(object sender, EventArgs e)
        {
            _countryName = null;
            if (countryComboBox.SelectedValue != null)
            {
                _countryName = (string)countryComboBox.SelectedValue;
            }
            refreshReport();
        }

        private void refreshReport()
        {
            this.customerLabelsReportTableAdapter.Fill(
                 this.simpleReportsDataSet.CustomerLabelsReport, _countryName);
            reportViewer1.RefreshReport();
        }
    }
}
